package com.ljc.dao;

import com.ljc.entity.Notification;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface NotifycationDao {

    void insert(Notification notification);
    @Select("select * from notification where admit_id=#{admitId} " +
            "and type=#{type} and end_time>NOW() order by created_time desc")
    List<Notification> findByAdmit(int admitId,int type);
    @Select("select * from notification where id=#{id}")
    Notification getOne(int id);

    List<Notification> search(Notification notification);

    @Delete("delete from notification where id=#{id}")
    void delete(int id);

    @Update("update notification set title=#{title},type=#{type},end_time=#{endTime}," +
            "author=#{author},content=#{content} where id=#{id}")
    void update(Notification notification);
}
